import { createBrowserRouter, Navigate } from 'react-router-dom'
import { lazy } from 'react'
import Layout from '../views/Layout'
import Login from '../views/Login'
import Home from '../views/Home'
import Article from '../views/Article'
import Publish from '../views/Publish'

const router = createBrowserRouter([
  {
    path: '/',
    element: <Navigate to="/layout/home" />
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/layout',
    element: <Layout />,
    children: [
      {
        path: 'home',
        element: <Home />
      },
      {
        path: 'article',
        element: <Article />
      },
      {
        path: 'publish/:id?',
        element: <Publish />
      }
    ]
  }
])
console.dir(router);
export default router
